package com.homson.coreservice.servicecommon.response;


import com.fasterxml.jackson.annotation.JsonIgnore;
import com.homson.coreservice.servicecommon.enumeration.BaseCodeEnum;
import com.homson.coreservice.servicecommon.enumeration.ResponseCodeEnum;


public abstract class AbstractResponse {
    
    private Integer code;
    private String message;
    
    public AbstractResponse(BaseCodeEnum responseCodeEnum, String message){
        this.code=responseCodeEnum.getCode();
        this.message=message;
    }
    @JsonIgnore
    public boolean isResponseRight() {
        return this.code.equals(ResponseCodeEnum.SUCCESS.getCode());
    }
    
    public Integer getCode() {
        return this.code;
    }
    
    public String getMessage() {
        return this.message;
    }
    
    public void setCode(final Integer code) {
        this.code = code;
    }
    
    public void setMessage(final String message) {
        this.message = message;
    }
    
    public boolean equals(final Object o) {
        if (o == this) {
            return true;
        } else if (!(o instanceof AbstractResponse)) {
            return false;
        } else {
            AbstractResponse other = (AbstractResponse)o;
            if (!other.canEqual(this)) {
                return false;
            } else {
                Object this$code = this.getCode();
                Object other$code = other.getCode();
                if (this$code == null) {
                    if (other$code != null) {
                        return false;
                    }
                } else if (!this$code.equals(other$code)) {
                    return false;
                }
                
                Object this$message = this.getMessage();
                Object other$message = other.getMessage();
                if (this$message == null) {
                    if (other$message != null) {
                        return false;
                    }
                } else if (!this$message.equals(other$message)) {
                    return false;
                }
                
                return true;
            }
        }
    }
    
    protected boolean canEqual(final Object other) {
        return other instanceof AbstractResponse;
    }
    
    
    
    public String toString() {
        return "AbstractResponse(code=" + this.getCode() + ", message=" + this.getMessage() + ")";
    }
    
    public AbstractResponse() {
    }
    
}
